package czhdao

import (
	"Cgo/front/models"
	"Cgo/global"
	"errors"
)

// import "Cgo/global"

type adminDao struct{}

var AdminDao = adminDao{}

// 获取用户信息
func (a adminDao) GetUserInfo(userId string) (models.CzhUser, error) {
	var userInfo models.CzhUser
	if r := global.DB.Raw("SELECT *,date_format(create_time,'%Y-%m-%d %H:%i:%s') as create_time FROM czh_user WHERE id = ?", userId).Scan(&userInfo); r.RowsAffected > 0 {
		return userInfo, nil
	} else {
		return userInfo, errors.New("没有查到数据")
	}
}
